<template lang="jade">
#qr-code
  //- .header
    a.backup.icon-angle-left(href='javascript:history.go(-1)')
    h1.page-title 扫码借/还书
  .body
    img#qrcode-img(v-if='src', :src='src')
</template>

<script>
import api from '../../api-new'

export default {
  data () {
    return {
      src: null
    }
  },
  created () {
    const uid = this.$cookie.get('uid')
    if (!uid) return
    this.src = api.qrcode(uid)
  }
}
</script>

<style lang="scss" scoped>
#qrcode-img {
  width: 200px;
  height: 200px;
  margin: 50% auto;
  display: block;
  border: 1px solid #ccc;
  transform: translateY(-50%);
}
</style>
